package com.tanhua.admin.controller;


import com.tanhua.admin.service.DashboardService;
import com.tanhua.model.vo.DashboardVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.Map;

@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    //概要统计信息
    @GetMapping("/summary")
    public ResponseEntity summary(){
        DashboardVo vo = dashboardService.summary();
        return ResponseEntity.ok(vo);
    }

    //新增、活跃用户、次日留存率
    @GetMapping("/users")
    public ResponseEntity users(@RequestParam Map map) throws ParseException {
        Map retMap = dashboardService.users(map);
        return ResponseEntity.ok(retMap);
    }

}
